package org.example.commonapi.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.servlet.http.HttpServletRequest;

/**
 * 学生刷题的历史记录
 * @TableName practice_history
 */
@TableName(value ="practice_history")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PracticeHistory implements Serializable {
    /**
     * 学生刷题历史记录id
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 学生id
     */
    private Long studentId;

    /**
     * 题目的id
     */
    private Long practiceId;

    /**
     * 正确or错误（1，0）
     */
    private Integer status;

    /**
     * 该用户提交的答案
     */
    private String answer;

    /**
     * 做题时间
     */
    private LocalDateTime createTime;


    /**
     * 构造函数
     * @param practice
     * @param studentId
     * @param answer
     */
    public PracticeHistory(Practice practice,Long studentId,String answer){
        this.practiceId = practice.getId();
        this.createTime = LocalDateTime.now();
        this.studentId=studentId;
        this.answer=answer;
    }


    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}